/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.yihu.wlyy.entity.Disease;

public interface DiseaseDao extends PagingAndSortingRepository<Disease, Long>, JpaSpecificationExecutor<Disease> {
	
	@Query("select a from Disease a where a.del = '1'")
	List<Disease> findAll();
	
	@Query("select a.name from Disease a where a.code = ?1")
	String findNameByCode(String code);

	/**
	 * 根据疾病code获取疾病信息
	 *
	 * @param code
	 * @return
	 */
	Disease findByCode(String code);
}
